<template>
  <div>
    <el-form ref="formItem" :model="formItem" label-width="100px" @submit.native.prevent>
      <el-form-item label="申请id：" v-if="formItem.id">
        <el-input class="form-sty" disabled v-model="formItem.id" placeholder style="width: 80%"></el-input>
      </el-form-item>
      <el-form-item label="联系人：">
        <el-input
          class="form-sty"
          v-model="formItem.linkName"
          placeholder="请输入联系人"
          style="width: 80%"
        ></el-input>
      </el-form-item>
      <el-form-item label="联系人手机：">
        <el-input
          class="form-sty"
          v-model="formItem.linkMobile"
          placeholder="请输入联系人手机"
          style="width: 80%"
        ></el-input>
      </el-form-item>
      <el-form-item label="性别：">
        <el-radio-group v-model="formItem.sex" class="form-sty">
          <el-radio :label="1">男</el-radio>
          <el-radio :label="2">女</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="职业技能：">
        <el-input
          class="form-sty"
          v-model.trim="formItem.skill"
          placeholder="请输入职业技能"
          :row="4"
          style="width: 80%"
        ></el-input>
      </el-form-item>
      <el-form-item label="从业时间：">
        <el-date-picker
          class="form-sty"
          type="date"
          v-model="formItem.workTime"
          placeholder="请选择从业时间"
          style="width: 80%"
          value-format="yyyy-MM-dd"
          format="yyyy-MM-dd"
          @on-change="formItem.work_time = $event"
        ></el-date-picker>
      </el-form-item>
      <el-form-item label="意向城市：">
        <el-select v-model="formItem.cityId" class="form-sty">
          <el-option
            v-for="(item, index) in city_list"
            :key="index"
            :value="item.id"
            :label="item.cityName"
          ></el-option>
        </el-select>
      </el-form-item>

      <el-form-item label="个人简介：">
        <el-input
          type="textarea"
          class="form-sty"
          v-model.trim="formItem.shortDesc"
          placeholder="请输入个人简介"
          style="width: 80%;resize:none"
        ></el-input>
      </el-form-item>

      <el-form-item label="驳回理由" v-if="formItem.status == 2">
        <el-input
          type="textarea"
          class="form-sty"
          v-model.trim="formItem.rejectReason"
          placeholder="未填写驳回理由"
          :disabled="true"
          style="width: 80%;resize:none"
        ></el-input>
      </el-form-item>
    </el-form>
  </div>
</template>
  
  <script>
import { getStaffApplyFromDataApi ,cityList} from '@/api/base';
export default {
  name: 'staff_apply_edit',
  props: {
    id: 0,
  },
  watch: {},
  data() {
    return {
      modals: false,
      labelShow: false,
      customerShow: false,
      orderStatus: 0,
      total_num: 0,
      splitSwitch: true,
      formItem: {
        uid: 0,
        cityId: '',
        skill: '',
        shortDesc: '',
        linkName: '',
        linkMobile: '',
        sex: '',
        status: '',
        statusDesc: '',
        workTime: '',
        rejectReason: '',
      },
      dataLabel: [],
      city_list:[],
    };
  },
  watch: {
    formItem: {
      handler(n, o) {
        // console.log(n)
        this.$emit('changeApplyData', n);
        // this.$emit.applyData.applyInfo = n
      },
      deep: true,
    },
  },
  created(){
    this.getCitys();
  },
  mounted() {
    this.getInfo()
  },
  methods: {
    getInfo() {
      getStaffApplyFromDataApi({ id: this.id }).then((res) => {
        let data = res;
        Object.entries(this.formItem).forEach(([index, item]) => {
          this.formItem[index] = data[index];
        });
      });
    },
    //获取城市列表
    getCitys() {
      cityList().then((res) => {
        let data = res;
        this.city_list = data.list;
      });
    },
  },
};
</script>
  
  <style lang="stylus" scoped>
  .labelInput {
    border: 1px solid #dcdee2;
    width: 400px;
    padding: 0 8px;
    border-radius: 5px;
    min-height: 30px;
    cursor: pointer;

    .span {
      color: #c5c8ce;
    }

    .iconxiayi {
      font-size: 12px;
    }
  }

  .ivu-form-item {
    margin-bottom: 10px;
  }

  .form-sty {
    width: 400px !important;
  }

  .addfont {
    display: inline-block;
    font-size: 13px;
    font-weight: 400;
    color: #1890FF;
    margin-left: 14px;
    cursor: pointer;
    margin-left: 10px;
  }

  .ivu-icon-ios-arrow-down {
    font-size: 14px;
  }

  .tip {
    color: #bbb;
  }
</style>
  